﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Northwind.NET.EDM.FE.WinForms.Controls;

namespace Northwind.NET.WPF.FE
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            windowsFormsHost1.Child = new ApplicationControlsManagerUserControl();

            ApplicationControlsManagerUserControl c = (ApplicationControlsManagerUserControl)windowsFormsHost1.Child;
            if (c != null)
            {
                c.BackColor = System.Drawing.SystemColors.Control;
                c.ControlLoaded += new EventHandler<BaseUserControl.ControlLoadedEventArgs>(controlLoaded);
                c.ShowCategoriesForm();
            }
        }

        public EventHandler<Northwind.NET.EDM.FE.WinForms.Controls.BaseUserControl.ControlLoadedEventArgs> ControlLoaded;
        private void controlLoaded(object sender, BaseUserControl.ControlLoadedEventArgs e)
        {
            this.Title = e.ControlTitle; 
        }


        private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            Window window = (Window)sender;
            mainGrid.Height = window.Height;
            mainGrid.Width = window.Width;

            windowsFormsHost1.Height = e.NewSize.Height - 30;
            windowsFormsHost1.Width = e.NewSize.Width;
       }

    }
}
